//
//  TwoNewsListTableViewCell.m
//  网易新闻
//
//  Created by lanou3g on 15/10/27.
//  Copyright © 2015年 马文强. All rights reserved.
//

#import "TwoNewsListTableViewCell.h"
#import "UIImageView+WebCache.h"
@implementation TwoNewsListTableViewCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        _titleLabel = [[UILabel alloc] init];
        [self.contentView addSubview:_titleLabel];
        _NewsImageView1 = [[UIImageView alloc] init];
        [self.contentView addSubview:_NewsImageView1];
        _NewsImageView2 = [[UIImageView alloc] init];
        [self.contentView addSubview:_NewsImageView2];
        _NewsImageView3 = [[UIImageView alloc] init];
        [self.contentView addSubview:_NewsImageView3];
    }
    return self;
}
- (void)layoutSubviews
{
    [super layoutSubviews];
    _titleLabel.frame = CGRectMake(10, 10, self.frame.size.width - 20, 30);
    _NewsImageView1.frame = CGRectMake(10, 50, (self.frame.size.width - 40)/3, 80);
    _NewsImageView2.frame = CGRectMake(20 + (self.frame.size.width - 40)/3, 50, (self.frame.size.width - 40)/3, 80);
    _NewsImageView3.frame = CGRectMake(30 + 2 * (self.frame.size.width - 40)/3, 50, (self.frame.size.width - 40)/3, 80);
}

#pragma mark ---- 创建Model对象
- (void)setModel:(NewsModel *)model
{
    _titleLabel.text = model.title;
    [_NewsImageView1 sd_setImageWithURL:[NSURL URLWithString:model.imgsrc]];
    [_NewsImageView2 sd_setImageWithURL:[NSURL URLWithString:model.imgextra[0][@"imgsrc"]]];
    [_NewsImageView3 sd_setImageWithURL:[NSURL URLWithString:model.imgextra[1][@"imgsrc"]]];
}

@end
